/*
========================================================================
 Name        : ExportContactsAppUi.h
 Author      : etouch.cc
 Copyright   : etouch.cc,All Right Reserved!
 Description : 
========================================================================
*/
#ifndef EXPORTCONTACTSAPPUI_H
#define EXPORTCONTACTSAPPUI_H

//includes
#include <aknviewappui.h>
#include <aknkeylock.h> 
#include <hwrmlight.h> 
#include "ContactEngine.h" 

class CExportContactsListBoxView;
class CExportContactsSelectDirContainerView;
class CExportContactsFileInputContainerView;
class CExportContactsExportingContainerView;
class CExportContactsStartContainerView;
class ContactEngine;

class CExportContactsAppUi : public CAknViewAppUi,
							 public MContactExportingNotify,
							 public MHWRMLightObserver
{
private:
	enum TDialogMsgType
	{
		EShowAbout,
		EShowHelp
	};
public: 	 
	CExportContactsAppUi();
	virtual ~CExportContactsAppUi();
	void  ConstructL();

public:	 
	TKeyResponse HandleKeyEventL( const TKeyEvent& aKeyEvent,TEventCode aType ); 
	void HandleCommandL( TInt aCommand );
	void HandleResourceChangeL( TInt aType ); 
	void HandleViewDeactivation( const TVwsViewId& aViewIdToBeDeactivated,const TVwsViewId& aNewlyActivatedViewId );
	
public:
	void LightStatusChanged(TInt aTarget, CHWRMLight::TLightStatus aStatus);
	
public:
	void ActiveView(const TInt aViewUid);	
	void SetExportFile(const TDesC& aExportFile);
	TDesC& GetExportFile();
	
	void StartExporting(); 
	static TInt ExportingCallback(TAny* aPtr);
	void ExportingNotify(const TInt aCurrentCount,const TInt aWholeCount);	
	static TBool RunExitQuery(const TDesC* aOverrideText = NULL);
	static void  ShowHelpOrAboutDialog(TDialogMsgType aMsgType);
	static  HBufC8* ReadText(const TDesC& aFileName);
	
public:
	TBool IsSv5System();
	
private:
	void InitializeContainersL();	
	 
private: 
	CExportContactsListBoxView* 		   iExportContactsListBoxView;
	CExportContactsSelectDirContainerView* iExportContactsSelectDirContainerView;
	CExportContactsFileInputContainerView* iExportContactsFileInputContainerView;	
	CExportContactsExportingContainerView* iExportContactsExportingContainerView;
	CExportContactsStartContainerView*	   iExportContactsStartContainerView;
	
private:
	ContactEngine*		iContactEngine;
	HBufC*			    iExportFile;
	CPeriodic*		    iExportingTimer;
	RAknKeyLock         iKeyLock;  
	CHWRMLight*         iLight;
	
};

#endif // EXPORTCONTACTSAPPUI_H			
